package com.huaxin.hxmodulestatisticalanalysis.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaxin.hxmodulestatisticalanalysis.dto.ResponseResult;
import com.huaxin.hxmodulestatisticalanalysis.models.DeviceDataCollectionWide;
import com.huaxin.hxmodulestatisticalanalysis.service.DeviceDataCollectionWideService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "采集数据记录")
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/statisticalanalysis/deviceDataCollectionWide")
public class DeviceDataCollectionWideController {
    private final DeviceDataCollectionWideService deviceDataCollectionWideService;

    //查询设备数据
    @Operation(summary = "查询设备数据")
    @GetMapping("/queryDeviceData")
    public ResponseResult<Page<DeviceDataCollectionWide>> queryDeviceData(@Parameter(description = "页码") @RequestParam(required = false, value = "pageNum") Integer pageNum,
                                                                          @Parameter(description = "页大小") @RequestParam(required = false, value = "pageSize") Integer pageSize,
                                                                          @Parameter(description = "设备ID") @RequestParam(value = "deviceId", required = false) String deviceId,
                                                                          @Parameter(description = "站点编号") @RequestParam(value = "stationNumber", required = false) String stationNumber,
                                                                          @Parameter(description = "设备类型") @RequestParam(value = "deviceType", required = false) String deviceType,
                                                                          @Parameter(description = "组织ID") @RequestParam(value = "orgId", required = false) String orgId,
                                                                          @Parameter(description = "家庭ID") @RequestParam(value = "familyId", required = false) String familyId) {
        return ResponseResult.ok(deviceDataCollectionWideService.queryDeviceData(pageNum, pageSize, deviceId, stationNumber, deviceType, orgId, familyId));
    }
}
